package com.atguigu.ai.all.func;

import org.springframework.stereotype.Component;

import java.util.function.Function;

@Component
public class RecruitServiceFunction implements Function<RecruitServiceFunction.Request, RecruitServiceFunction.Response> {
    /**
     * 根据请求中的姓名信息返回对应的职位信息
     * @param request 包含姓名信息的请求对象
     * @return 返回包含职位信息的响应对象
     */
    @Override
    public Response apply(Request request) {
        String position = "未知";
        // 根据姓名判断职位
        if(request.name.contains("张三")){
            position = "算法工程师";
        }
        return new Response(position);
    }


    public static class Request {
        private String name;

        public Request() {}

        public Request(String name) {
            this.name = name;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }

    public static class Response {
        private String position;

        public Response() {}

        public Response(String position) {
            this.position = position;
        }

        public String getPosition() {
            return position;
        }

        public void setPosition(String position) {
            this.position = position;
        }
    }
}
